<template>
    <div>
        <el-card style="margin-top: 10px;">
            <template #header>
                <div class="card-header">
                    <span>样品确认清单</span>
                </div>
            </template>
            <sc-form-table v-model="dataList" disabled placeholder="暂无数据">
                <template #tableContent>
                    <el-table-column prop="number" label="送样单编号" width="150">
                    </el-table-column>
                    <el-table-column prop="custName" label="客户名称" width="200">
                    </el-table-column>
                    <el-table-column prop="deliverDate" label="送样日期" width="150">
                    </el-table-column>
                    <el-table-column prop="diliverByName" label="送样人" width="120">
                    </el-table-column>
                    <el-table-column prop="sampleAuditNumber" label="评审表编号" width="150">
                    </el-table-column>
                    <el-table-column prop="drawingNo" label="图号" width="120">
                    </el-table-column>
                    <el-table-column prop="carbonBrushSpec" label="炭刷规格" width="150">
                    </el-table-column>
                    <el-table-column prop="receivedDate" label="客户收到日期" width="160">
                        <template #default="scope">
                            <el-date-picker v-model="scope.row.receivedDate" type="date" placeholder="请选择日期"
                                value-format="YYYY-MM-DD" />
                        </template>
                    </el-table-column>
                    <el-table-column prop="receiver" label="接收人" width="150">
                        <template #default="scope">
                            <el-input v-model="scope.row.receiver"></el-input>
                        </template>
                    </el-table-column>
                    <el-table-column prop="receivedStatus" label="接收状态代码" width="200">
                        <template #default="scope">
                            <el-select v-model="scope.row.receivedStatus" clearable placeholder="请选择：">
                                <el-option v-for="item in configData.receivedStatusList" :key="item.value"
                                    :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>
                        </template>
                    </el-table-column>
                </template>
            </sc-form-table>
        </el-card>
        <div class="button-position">
            <el-button type="primary" @click="confirm">确 认</el-button>
        </div>
    </div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import Api from '@/api/model/sample'
import { ElNotification } from 'element-plus';
const emit = defineEmits(['updatetable'])
const props = defineProps({
    paramsData: {
        type: Object,
        defalut: {}
    }
})
const dataList = ref([])
const configData = ref({})
onMounted(() => {
    getInit()
})
const getInit = async () => {
    let res = await Api.sendSample.initConfirmCustRecived.post(props.paramsData)
    if (res.code == 200) {
        dataList.value = res.dataList
        configData.value = res.configData
    }
}
const confirm = async () =>{
    let param = {
        dataList:dataList.value
    }
    let res = await Api.sendSample.confirmCustReceived.post(param)
    if (res.code == 200) {
        ElNotification.success({ title: '', message: '操作成功！', duration: 2000 });
        emit('updatetable', true);
    }
}
</script>